//BCD转int
int BCDToInt(uint8_t value)
{
	int temp = 0;
	temp = (value >> 4) * 10 + (value & 0x0F);
	return temp;
}

//int转BCD
uint8_t IntToBCD(int value)
{
    uint8_t temp;
    temp = (((value / 10) << 4) + (value % 10));
    return temp;
}


//test
#include <stdio.h>
#include "stdint.h"
int main()
{
    uint8_t data[] = {0x52, 0x23, 0x81};
    int a = BCDToInt(data[0]);
   
    uint8_t b = IntToBCD(25);
    
    printf("a=%d,b=%x\n", a, b);
}